/*
 * Copyright © 2022 XXXXXXXXX
 * @Author: zhangxiang
 * @Date: 2022-07-19 09:42:10
 * @LastEditors: zhangxiang
 * @LastEditTime: 2023-02-07 15:46:45
 * @Description:
 *
 */

import defaultSettings from '@/settings'
import store from '@/store'

const title = defaultSettings.title || '算网一体编排调度平台' // 名称

function getMenuTitle(key, val) {
  const menuName = store.state.app.menuName
  if (Object.prototype.hasOwnProperty.call(menuName, key)) {
    return menuName[key].menuValue || val
  }
  return val
}

/**
 * @description: 获取页面名称
 * @param {*} pageTitle
 * @return {*}
 */
export default function getPageTitle(pageTitle, pageKey) {
  if (pageTitle) {
    return `${getMenuTitle(pageKey, pageTitle)} - ${getMenuTitle('App', title)}` // 拼接
  }
  return `${title}`
}
